/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package asja.dao;

import asja.bd.Conexao;
import asja.modelo.NotasModelo;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 *
 * @author Alice
 */
public class NotasDao {
    
    private Connection conecta;
    
    public NotasDao() throws SQLException {
        
        this.conecta = Conexao.getConnection();
    }
    
    // método para adicionar usuário do sistema.
    public void adiciona(NotasModelo in) throws SQLException{
     String adi= "insert into notas (nome, frequencia, nota1, nota2, nota3, nota4, nota5) values(?,?,?,?,?,?,?);";
     
     PreparedStatement stm = conecta.prepareStatement(adi); 
     stm.setString(1, in.getNome());
     stm.setFloat(2, in.getFrequencia());
     stm.setFloat(3, in.getNota1());
     stm.setFloat(4, in.getNota2());
     stm.setFloat(5, in.getNota3());
     stm.setFloat(6, in.getNota4());
     stm.setFloat(7, in.getNota5());    
     stm.execute(); //executa o comando para salvar no banco;
     stm.close();
   
    }
    
}
